

import 'package:erp/Entity/PurchaseOrder.dart';
import 'package:erp/Events/EventAddrs.dart';
import 'package:erp/Store/AccountStore.dart';
import 'package:erp/global.dart';

void registerPurchaseOrderEvents(){
  globalBus.subscribe<PurchaseOrder>(Events.PURCHASE_ORDER_DETAIL_SELECT_REQUEST, (bus, data) async {
//    try {
      var result = await externalInterface.getProductsInPurchaseOrder(AccountStore.signInResult.token, data);
      data.products = result;
      globalBus.publish(Events.PURCHASE_ORDER_DETAIL_SELECT_SUCCESS, result);
//    }
//    catch (exception){
//      globalBus.publish(Events.PURCHASE_ORDER_DETAIL_SELECT_ERROR, exception);
//    }
  });
}
